﻿<!-- 
=====================================================================
  This file is part of a Microsoft SQL Server Shared Source Application.
  Copyright (C) Microsoft Corporation.  All rights reserved.
 
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
======================================================= 
-->
<!-- This is the main window of the application.  It is used to browse and edit information about products in the 
     AdventureWorksLT2008 database -->
<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="Microsoft.SqlCommunity.FaultRetry.ProductEditorWindow"
    xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
	x:Name="ProductEditor"
	Title="Product Editor"
	Width="846" Height="564" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    
    <Window.Resources>
        <DataTemplate x:Key="BoldTemplate">
            <TextBlock Text="{Binding}" FontWeight="Bold" />
        </DataTemplate>
        <DataTemplate x:Key="ProductImageTemplate">
            <Image Source="{Binding Path=ThumbNail}" />
        </DataTemplate>
        <DataTemplate x:Key="ProductNameTemplate">
            <TextBox Text="{Binding Path=Name, Mode=TwoWay}" />
        </DataTemplate>
        <DataTemplate x:Key="ListPriceTemplate">
            <TextBox Text="{Binding Path=ListPrice, Mode=TwoWay}"/>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="ProductCategoryTemplateL2">
            <TextBlock Text="{Binding Path=Name}" />
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="ProductCategoryTemplateL1"
                                  ItemsSource="{Binding Path=ProductCategories}"
                                  ItemTemplate="{StaticResource ProductCategoryTemplateL2}">
            <TreeViewItem Header="{Binding Path=Name}" HeaderTemplate="{StaticResource BoldTemplate}"/>
        </HierarchicalDataTemplate>

    </Window.Resources>

	<Grid x:Name="LayoutRoot" Background="{StaticResource EditorBackgroundBrush}">
		<ScrollViewer x:Name="DataScrollViewer" Margin="277,74,25,150">
			<ListView IsSynchronizedWithCurrentItem="True" x:Name="DataListView" Width="Auto" ItemsSource="{Binding SelectedItem.Products, ElementName=CategoryTreeView}">
				<ListView.View>
					<GridView x:Name="DataGridView">
                        <GridViewColumn Header="Product" CellTemplate="{StaticResource ProductImageTemplate}">
                        </GridViewColumn>
                        <GridViewColumn Header="Product Name" CellTemplate="{StaticResource ProductNameTemplate}">
                        </GridViewColumn>
                        <GridViewColumn Header="List Price" CellTemplate="{StaticResource ListPriceTemplate}"/>
					</GridView>
				</ListView.View>
			</ListView>
		</ScrollViewer>
		<ScrollViewer HorizontalAlignment="Left" Margin="17,74,0,150" x:Name="CategoryScrollViewer" Width="239">
			<TreeView x:Name="CategoryTreeView" Width="Auto" Height="Auto" ItemTemplate="{StaticResource ProductCategoryTemplateL1}" 
                      SelectedItemChanged="CategoryTreeView_SelectedItemChanged" />
		</ScrollViewer>
		<Button Margin="320,0,0,101" x:Name="SaveButton" VerticalAlignment="Bottom" Content="Save"  Width="79.923" Click="SaveButton_Click" Height="28" HorizontalAlignment="Left" />
		<Button Margin="0,0,311,101" x:Name="ClearButton" VerticalAlignment="Bottom" Content="Clear"  HorizontalAlignment="Right" Width="61.893" Height="28" Click="ClearButton_Click" />
		<Button x:Name="ExitButton" HorizontalAlignment="Right" Margin="0,0,174,101" VerticalAlignment="Bottom" Content="Exit"   Width="81.44" Click="ExitButton_Click" Height="28" />
		<Label x:Name="TitleLabel" VerticalAlignment="Top" Content="AdventureWorks Product Editor" Height="39.96" Margin="236,12,233,0" FontSize="24" FontFamily="Imprint MT Shadow" Foreground="#FFFFFFFF"/>
        <Button Name="ConfigureButton" HorizontalAlignment="Left" Margin="176,0,0,101" VerticalAlignment="Bottom" Width="110" Click="ConfigureButton_Click" Height="28">Configure</Button>
        <ScrollViewer  Height="83" Margin="12,0,0,12" BorderThickness="2,2,2,2" BorderBrush="#FFFF0000" Name="MessageScrollViewer" VerticalAlignment="Bottom"
                       Visibility="Hidden">
            <TextBlock x:Name="MessageTextBlock" Margin="17,0,25,30" VerticalAlignment="Bottom" Text="" TextWrapping="Wrap" />
        </ScrollViewer>
    </Grid>
</Window>